import request from '@/utils/request'

// 获取话题列表
export const topicGetTopicListService = (params?: Api.Topic.GetTopicListParams) => {
  return request.get<Api.Topic.TopicListResponse>('/topics/getTopicList/', { params })
}

//删除帖子
export const topicDeleteTopicService = (ids: number[]) => {
  return request.delete<Api.Topic.TopicListResponse>('/topics/deleteTopic/', {
    data: { ids }
  })
}

//获取话题详情
export const topicGetTopicDetailService = (id: number) => {
  return request.get<Api.Topic.TopicDetailResponse>(`/topics/${id}/getTopicDetail/`)
}
//添加话题
export const topicAddTopicService = (data: FormData) => {
  return request.post<Api.Topic.TopicDetailResponse>('/topics/addTopic/', data)
}
//更新话题
export const topicUpdateTopicService = (data: FormData) => {
  return request.post<Api.Topic.TopicDetailResponse>('/topics/updateTopic/', data)
}

//管理员更改话题状态
export const topicChangeTopicService = (data: { id: number; t_kind: string; recommend: boolean }) => {
  return request.post<Api.Topic.TopicDetailResponse>('/topics/adminChangeTopic/', data)
}
